@extends("admin.frame_layout")
<?php $top_selected = "系统设置";$page_menu = "管理员" ?>
@section('content')
    <div class="rightinfo">
        <div class="tools">
            <ul class="toolbar">
                <li>
                    <a href="{{route('admin.admins.edit',['id'=>0])}}">
                        <span><img src="{{asset('admin/imgs/t01.png')}}"/></span>添加新管理员
                    </a>
                </li>
            </ul>
        </div>

        <table class="tablelist">
            <thead>
            <tr>
                <th width="70px">操作</th>
                <th>编号<i class="sort"><img src="{{asset('admin/imgs/px.gif')}}"/></i></th>
                <th>用户名</th>
                <th>身份</th>
                <th>最后登录时间</th>
                <th>登录IP</th>
            </tr>
            </thead>
            <tbody>
            @foreach($admins as $admin)
                <tr>
                    <td class="act" bind="#{{$admin->id}}">
                        <img src="{{asset('admin/imgs/t05.png')}}"/>菜单
                        <ul id="{{$admin->id}}">
                            <li>
                                <a href="{{route('admin.admins.edit',['id'=>$admin->id])}}">
                                    <img src="{{asset('admin/imgs/d02.png')}}"/>编辑管理员
                                </a>
                            </li>
                            <li onclick="openOkDlg('{{route('admin.admins.del',['id'=>$admin->id])}}')">
                                <img src="{{asset('admin/imgs/d02.png')}}"/>删除
                            </li>
                        </ul>
                    </td>
                    <td>{{$admin->id}}</td>
                    <td>{{$admin->username}}</td>
                    <td>{{$admin->roles->first()->name or "无角色"}}</td>
                    <td>{{date("Y-m-d H:i:s",$admin->lasttime)}}</td>
                    <td>{{$admin->lastip or "从未登录过"}}</td>
                </tr>
            @endforeach
            </tbody>
        </table>
    </div>

    @include('admin.coms.dialog')
@endsection
@section('footer')
    <script type="text/javascript">
        $(document).ready(function () {
            //初始化表格操作菜单
            $('.tablelist tbody tr:odd').addClass('odd');
            $(".tablelist .act").hover(function () {
                $($(this).attr("bind")).show();
            }, function () {
                $($(this).attr("bind")).hide();
            });
        });
    </script>
@endsection

